<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
	<link rel="stylesheet" type="text/css" href="../../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
  <title>学术</title>
  <style>
		html, body {width: 100%;min-height: 100%;background: #fff;}
		.h20 {height: 0.5rem;}

    .detail_con {
      padding: 1rem;
      margin-bottom: 3rem;
    }
    .detail_title h3 {
      font-size: 0.9rem;
      color: #333;
    }
    .detail_tit_sm h4 {
      font-size: 0.75rem;
      color: #333;
      font-weight: bold;
      line-height: 1.2rem;
    }
    .detail_addtime h6 {
      font-size: 0.6rem;
      color: #999;
      margin: 1rem 0;
    }
    .detail_text p {
      font-size: 0.75rem;
      line-height: 1.2rem;
      color: #333;
      margin: 1rem 0;
    }
    .detail_text p img {
      width: 100%;
    }
    .detail_like {
      text-align: center;
      border-top: 1px solid #f0f0f0;
      display: block;
      width: 100%;
      margin: 0 -1rem;
      padding: 0.5rem 1rem;
    }
    .detail_like img {
      width: 1rem;
      display: inline-block;
    }
    .aui-list-item-title {}
    .detail_pl {
      margin: 0 -1rem;
      padding: 0.5rem 1rem;
      border-top: 1rem solid #f0f0f0;
    }
    .detail_pl .aui-media-list-item-inner {
      -webkit-box-align: start;
      box-align: start;
      -webkit-align-items: flex-start;
      align-items: flex-start;
    }
    .detail_pl .aui-list-item-right {}
    .detail_pl .aui-list-item-text {
      font-size: 0.75rem;
      line-height: 1rem;
      color: #333;
    }
    .detail_pl .aui-list-item-text span {
      color: #999;
      font-size: 0.6rem;
    }
    .detail_pl .aui-list-item-right > div {
      color: #999;
      display: inline-block;
    }
    .detail_pl .aui-list-item-right > div img {
      width: 0.6rem;
      display: inline-block;
    }
    .detail_pl .aui-list-item-right > div:first-child {
      margin-right: 0.6rem;
    }
    .detail_pl .aui-list-item-right > div:nth-child(2) {}
    .detail_pl .text_inner {
      background: #f0eff5;
      padding: 0.3rem;
      margin-top: 0.5rem;
    }
    .detail_pl .text_inner ul {}
    .detail_pl .text_inner ul li {
      color: #666;
      line-height: 1.2rem;
      font-size: 0.75rem;
    }
    .detail_pl .text_inner ul li span {
      color: #333;
      font-weight: bold;
      font-size: 0.75rem;
    }
    .detail_pl .text_inner ul li img {
      width: 0.3rem;
      display: inline-block;
    }
    .detail_talk {
      position: fixed;
      bottom: 0;
      width: 100%;
      background: #fff;
      padding: 0.25rem;
      border-top: 1px solid #f0f0f0;
    }
    .detail_talk {
      padding-right: 3.6rem;
    }
    .detail_talk .detail_talk_inp {
      width: 100%;
      display: inline-block;
      border: 1px solid #999;
      -webkit-border-radius: 0.8rem;
      -moz-border-radius: 0.8rem;
      border-radius: 0.8rem;
      padding: 0 1rem;
    }
    .detail_talk .detail_talk_inp input{
      font-size: 0.7rem;
      height: 1.6rem;
    }
    .detail_talk_ri {
      position: absolute;
      right: 0.2rem;
      bottom: 0;
    }
    .detail_talk_ri img {
      width: 1.2rem;
      margin: 0.2rem 0 0.2rem 0.4rem;
      display: inline-block;
    }
	</style>
</head>
<body>
  <div id="app">
    <div class="detail_con">
      <div class="detail_title">
        <h3>{{detail.title}}</h3>
      </div>
      <div class="detail_addtime">
        <h6>{{detail.publishTime}}</h6>
      </div>
      <div class="detail_text" v-html="detail.content"></div>
      <div class="detail_like">
        <img src="../../image/focus.png" alt="">{{likenumCount}}
      </div>
      <div class="h20"></div>
      <div class="detail_pl">
        <div class="detail_tit_sm">
          <h4>最新评论</h4>
        </div>
        <div class="aui-content">
          <ul class="aui-list aui-media-list" v-if="commentList.length > 0">
            <li class="aui-list-item aui-list-item-middle" v-for="items in commentList">
              <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width: 3rem;">
                  <img :src="items.userImage" class="aui-img-round aui-list-img-sm">
                </div>
                <div class="aui-list-item-inner">
                  <div class="aui-list-item-text">
                    <div class="aui-list-item-title aui-font-size-14">{{items.username}}</div>
                  </div>
                  <div class="aui-list-item-text">
                    <span>{{items.create_date}}</span>
                    <div class="aui-list-item-right">
                      <div>
                        <!--<img src="../../image/dz1@3x.png" alt="">-->
                        <img src="../../image/dz2@3x.png" alt="">
                        {{items.likenum}}
                      </div>
                      <div>
                        <img src="../../image/hf@3x.png" alt="">
                        回复
                      </div>
                    </div>
                  </div>
                  <div class="aui-list-item-text">
                  {{items.content}}
                  </div>
                  <div class="aui-list-item-text text_inner">
                    <ul>
                      <li v-for="item in items.chirldList"><span>{{item.username}}：</span>{{item.content}}</li>
                      <li>查看全部{{items.chirldList.length}}条评论 <img src="../../image/jr2@3x.png" alt=""></li>
                    </ul>
                  </div>
                </div>
              </div>
            </li>
          </ul>
          <h5 v-else style="text-align: center">暂无评论</h5>
        </div>
      </div>
    </div>
    <div class="detail_talk">

      <div class="detail_talk_inp">
        <input type="text" placeholder="我来说两句...">
      </div>
      <div class="detail_talk_ri">
        <img class="sc" src="../../image/shoucang@3x.png" onclick="sc()" alt="">
        <!--<img class="sc" src="../../image/shoucang2@3x.png.png" alt="">-->
        <img src="../../image/fx@3x.png" onclick="fx()" alt="">
      </div>
    </div>
  </div>

<script type="text/javascript" src="../../script/zepto.js" ></script>
<script type="text/javascript" src="../../script/vue.min.js" ></script>
<script type="text/javascript" src="../../script/aui-toast.js" ></script>
<script type="text/javascript" src="../../script/api.js" ></script>
<script type="text/javascript">

	apiready = function() {
		var URL = 'http://kexiecs.unohacha.com/kexieScore';
    var id = api.pageParam.id
		var app = new Vue({
			el: '#app',
			data: {
        detail: {},
        page: 1,
        commentList: [],
        likenumCount: []
			},
			created: function() {
				var $_this = this;
				api.ajax({
				  url: window.Url.getArticleDetail + id,
					timeout: 300,
				}, function(ret, err) {
				    if (ret) {
				        // api.alert({ msg: JSON.stringify(ret) });
								$_this.detail = ret.data[0]
				    } else {
				        api.alert({ msg: JSON.stringify(err) });
				    }
				})
				api.ajax({
				  url: window.Url.getCommentList + id + '/' + $_this.page,
					timeout: 300,
				}, function(ret, err) {
				    if (ret) {
				        // api.alert({ msg: JSON.stringify(ret) });
                if (ret.data) {
                  	$_this.commentList = ret.data.newsList
                } else {
                  $_this.commentList = []
                }

				    } else {
				        api.alert({ msg: JSON.stringify(err) });
				    }
				})
				api.ajax({
				  url: window.Url.articleLikenumCount + id,
					timeout: 300,
				}, function(ret, err) {
				    if (ret) {
				        // api.alert({ msg: JSON.stringify(ret) });
								$_this.likenumCount = ret.data.count
				    } else {
				        api.alert({ msg: JSON.stringify(err) });
				    }
				})
			}
		})
	}
  function sc () {

    api.openFrame ({
      name: 'collection',
      url: './collection.html',
      rect:{
        x:0,
        y:0,
        w:'auto',
        h:'auto'
      },
      bounces: false,
      delay:200
    })
    api.closeFrame({name:'more'});
  }

  function fx () {
    api.openFrame ({
      name: 'share',
      url: './share.html',
      rect:{
        x:0,
        y:0,
        w:'auto',
        h:'auto'
      },
      bounces: false,
      delay:200
    })
    api.closeFrame({name:'more'});
  }
</script>
</body>
</html>
